$(()=>{
	sessionStorage.phoneNumber && $("#user").val(sessionStorage.phoneNumber);
	$(".iconfont").click(()=>{
		open("../html/register.html","_self");
	})
	$("#user").attr("readonly","readonly");
	let pswReg = /^\w{8,16}$/,
	emailReg = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/; 
	$("#pswd").on("input",()=>{
		$("#pswd").css("color",pswReg.test($("#pswd").val()) ? "green" : "red");
	})
	$("#yzm").on("input",()=>{
		$("#yzm").css("color",emailReg.test($("#yzm").val()) ? "green" : "red");
	})
	$("form").submit(()=>{
		if($("#pswd").css("color") == "rgb(0, 128, 0)" && $("#yzm").css("color") == "rgb(0, 128, 0)"){
			open("../html/login.html","_self");
		}else{
			return false;
		}
	})
})
